<?php
require_once 'connect/mydb.class.php';
 
if (!isset($mysql)) {
    // 还是用这个方法吧,避免多次实例化
    $mysql = new mydb();
}
echo substr("68120002", 0, pow(2, 1)) . "<br>";
echo substr("68120002", 0, pow(2, 2)) . "<br>";
echo substr("68120002", 0, pow(2, 3)) . "<br>";

$setting = "奥斯卡梦幻影城|1";
$cjlist = explode(",", $setting);
$cjnum = count($cjlist);
echo "cnt=" . $cjnum;

$a = array("0" => "red", "1" => "green", "2" => "red");
print_r(array_unique($a));
echo "<br><br>";
$data = array(array('sku' => 'KECY2772HS09', 'barcode' => "", 'sellerPath' => '26130001'),
    array('sku' => '183D10330902', 'barcode' => "", 'sellerPath' => '26110001'));
var_dump($data);

$link = mysqli_connect('localhost', 'root', 'root', 'ymall');
if (mysqli_connect_errno($link)) {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
} else {
    echo '数据库连接成功';
}
echo "<br><br>";
$data = array(array('sellerPath' => '68120001'),
    array('sellerPath' => '68120002'));

echo "old_data=";
var_dump($data);
echo "<br><br>";
$query = "SELECT * FROM temp_data";
// echo $query;
$result = mysqli_query($link, $query);

if (!$result) {
    printf("Error: %s\n", mysqli_error($link));
    exit();
}
while ($row = mysqli_fetch_assoc($result)) {
    $arr[] = $row;
}
// var_dump($arr);
// 取组织架构的data
$data = $mysql->new_arr($arr, "ymall_erp_group");

echo "<br>data=";
var_dump($data);
